<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<title>#{msg['title']}</title>
	<!-- TODO para mudar o icone do titulo da aba <link rel="shortcut icon" href="/favicon.ico" />-->
	<script type="text/javascript"
		src="#{request.contextPath}/resources/scripts/sgc.js" />
	<link type="text/css" rel="stylesheet"
		href="#{request.contextPath}/resources/styles/sgc.css" />

</h:head>

<h:body onload="dlg.show();" style="font-size: 10px;">
	<p:growl id="growl" showDetail="true" life="9000" />
	<h:form id="form">

		<p:dialog header="Login" widgetVar="dlg" resizable="false"
			draggable="false" closable="false" width="250">

			<h:panelGrid columns="3" style="margin-bottom:10px">
				<h:outputLabel for="login" value="Login:" />
				<p:inputText id="login" value="#{controleBean.login}"
					required="true"
					requiredMessage="O campo Login &#233; obrigat&#243;rio."
					validator="#{controleBean.validaCase}" />
				<div class="ui-widget ui-helper-clearfix">
					<div class="ui-state-default ui-corner-all">
						<span class="ui-icon ui-icon-help" title="Apenas N&#250;meros"
							style="width: 16px; height: 16px;"></span>
					</div>
				</div>

				<h:outputLabel for="senha" value="Senha:" />
				<p:inputText id="senha" type="password"
					value="#{controleBean.password}" required="true"
					requiredMessage="O campo Senha &#233; obrigat&#243;rio." />
				<p:commandButton icon="ui-icon-circle-arrow-e" title="Login"
					ajax="false" action="#{controleBean.logar}" update=":growl" />
			</h:panelGrid>
			<f:facet name="footer">

				<p:commandButton id="modalDialogButtonCadastro" value="Cadastre-se"
					onclick="dlg1.show();" type="button" style="float: left;" />
				<p:commandButton id="modalDialogButtonEsqueci"
					value="Esqueci a senha!" onclick="dlg2.show();" type="button"
					style="float: right;" />

			</f:facet>
		</p:dialog>
	</h:form>
	<h:form id="form1">
		<p:dialog header="Cadastro" widgetVar="dlg1" resizable="false"
			draggable="false" closable="false" modal="true">

			<p:panelGrid columns="2">

				<h:outputLabel for="matricula" value="Matricula: " />
				<p:inputText id="matricula" value="#{controleBean.matricula}"
					required="true"
					requiredMessage="O campo matricula &#233; necess&#225;rio." />

				<h:outputLabel for="fullname" value="Nome Completo: " />
				<p:inputText id="fullname" value="#{controleBean.nome}"
					required="true"
					requiredMessage="O campo nome &#233; necess&#225;rio." />

				<h:outputLabel for="telephone" value="Telefone: " />
				<p:inputText id="telephone" value="#{controleBean.telefone}"
					required="true"
					requiredMessage="O campo telefone &#233; necess&#225;rio." />

				<h:outputLabel for="Email" value="E-mail: " />
				<p:inputText id="Email" value="#{controleBean.email}"
					required="true"
					requiredMessage="O campo e-mail &#233; necess&#225;rio." />

				<h:outputLabel for="Rua" value="Endere&#231;o: " />
				<p:inputText id="Rua" value="#{controleBean.rua}" required="true"
					requiredMessage="O campo rua &#233; necess&#225;rio." />

				<h:outputLabel for="numero" value="Numero: " />
				<p:inputText id="numero" value="#{controleBean.numero}"
					required="true"
					requiredMessage="O campo numero &#233; necess&#225;rio." />

				<h:outputLabel for="Complemento" value="Complemento: " />
				<p:inputText id="Complemento" value="#{controleBean.complemento}"
					required="true"
					requiredMessage="O campo complemento &#233; necess&#225;rio." />

				<h:outputLabel for="UF" value="UF: " />
				<p:inputText id="UF" value="#{controleBean.uf}" required="true"
					requiredMessage="O campo uf &#233; necess&#225;rio." />

				<h:outputLabel for="Bairro" value="Bairro: " />
				<p:inputText id="Bairro" value="#{controleBean.bairro}"
					required="true"
					requiredMessage="O campo bairro &#233; necess&#225;rio." />

				<h:outputLabel for="cep" value="CEP: " />
				<p:inputText id="cep" value="#{controleBean.cep}" required="true"
					requiredMessage="O campo cep &#233; necess&#225;rio." />
			</p:panelGrid>

			<f:facet name="footer">
				<p:row>
					<p:column style="text-align: right">
						<p:commandButton action="#{controleBean.cadastrarUsuario}"
							value="Envia" icon="ui-icon-check" oncomplete="dlg1.hide()"
							update=":growl" />
					</p:column>
					<p:column>
						<p:commandButton type="reset" value="Limpa" icon="ui-icon-trash" />
					</p:column>
					<p:column>
						<p:commandButton value="Cancela" onclick="dlg1.hide()"
							icon="ui-icon-close" />
					</p:column>
				</p:row>
			</f:facet>
		</p:dialog>
	</h:form>
	<h:form id="form2">
		<p:dialog header="Esqueci Senha" widgetVar="dlg2" resizable="false"
			draggable="false" closable="false">
			<!-- TODO esqueciSenha = colocar pra funcionar -->
			<p:panelGrid columns="2">
				<h:outputText value="Matricula:" />
				<p:inputText value="#{controleBean.matricula}" />
				<h:outputText value="E-mail:" />
				<p:inputText value="#{controleBean.email}" />
				<f:facet name="footer">
					<p:row>
						<p:column>
							<p:commandButton
								action="#{controleBean.cadastrarSolicitacaoEsqueciSenha}"
								value="Envia" icon="ui-icon-check" oncomplete="dlg2.hide()"
								update=":growl" />
						</p:column>
						<p:column>
							<p:commandButton type="reset" value="Limpa" icon="ui-icon-trash" />
						</p:column>
						<p:column>
							<p:commandButton value="Cancela" onclick="dlg2.hide()" />
						</p:column>
					</p:row>
				</f:facet>
			</p:panelGrid>
		</p:dialog>
	</h:form>
</h:body>
</html>